home *** CD-ROM | disk | FTP | other *** search
- Path: peer-news.britain.eu.net!strath-cs!abrown
- From: abrown@cs.strath.ac.uk (Andrew G Brown CES92)
- Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c
- Subject: Help: Inter Process Queues
- Date: 7 Mar 1996 14:00:05 GMT
- Organization: Computer Science Dept., Strathclyde University., Glasgow, Scotland.
- Distribution: world
- Message-ID: <4hmq55$2sn@dunlop.cs.strath.ac.uk>
- NNTP-Posting-Host: muir-01.cs.strath.ac.uk
-
- I was wondering if anyone out there could show me how to set up a
- UNIX queue between a number of processes written in 'C'.
-
- I have initiated the queue using msgget() which returns the Q id.
- However I am not sure what permissions I need to set in the msqid_ds
- structure that I need to pass to msgctl().
-
- At the moment I m trying the following...
-
- key = ftok("queue", 'z')
- qid = msgget( key, IPC_CREAT);
-
- buf.msg_perm.uid = getuid();
- buf.msg_perm.gid = getgid();
- buf.msg_perm.cuid = PERM.uid;
- buf.msg_perm.cgid = PERM.gid;
- buf.msg_perm.mode = 0x1FF; /* <= 111,111,111 */
- buf.msg_perm.seq = 0;
- buf.msg_perm.key = key;
-
- buf.msg_qbytes = 10240;
- buf.msg_ctime = time( NULL );
-
- msgctl(qid, IPC_SET, &buf);
-
- However when I attempt to send a message to the queue from the same
- process using msgsnd() I get an EACESS error, meaning that I do not
- have the correct permission.
-
- Any help would be greatly appreciated, as this queue is an
- important part of an application I am writing for my final year
- project.
-
-
- Many thanks..
-
-
- Andrew Brown
-